{__NOLAYOUT__}
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport"
		  content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
	<title></title>
	{include file="public/script" /}
	<style type="text/css">
		.container a{display: block;}
		.pass{
			border: 1px solid green;
			border-radius: 30%;
			font-size: 14px;
			color: white;
			background-color: green!important;
			padding: 3px;
		}
	</style>
</head>
<body>
	<div class="sectionH  sectionH2 mui-clearfix">
		<header class="mui-bar mui-bar-nav" style="">
			<a class="mui-icon mui-icon-left-nav  mui-pull-left" href="{:url('User/index')}" style="color: #727272;"></a>
			<h1 class="mui-title">互通合约</h1>
			<!--<a class="mui-icon mui-pull-right right1" href="assets-1.html"><img src="images/icon_setting.png"/></a>-->
		</header>
	</div>
	<div class="kong1"></div>
	<div class="lian_news_section11">
		<div class="mui-clearfix">
			<ul>
				<li style="width:50%;" onclick="javascript:location.href='{:url('User/agreementList',['type'=>1])}';" {if condition="$type==1"}class="select"{/if}>我申请</li>
				<li style="width:50%;" onclick="javascript:location.href='{:url('User/agreementList',['type'=>2])}';" {if condition="$type==2"}class="select"{/if}>别人申请</li>
			</ul>
		</div>
	</div>
	<div class="kong1"></div>
	<div class="shanghui_lingdao_section1" id="items">
		<div class="container">
			<div class="items">
				{volist name="list" id="agreement"}
				<div class="lingdao1">

					<div class="items_1 mui-clearfix">
						<a href="{:url('Bussiness/index',array('id'=>$agreement.bussiness_id))}">
							<div class="div1">
								<img src="{$agreement.avatar|default='/static/default_avatar.png'}" alt="" />
							</div>
						</a>
						<div class="div2">
							<p class="p1"><span class="s1">{$agreement.title}</span> </p>
							<p>{$agreement.create_time|show_datetime}</p>
						</div>
						<div class="div3">
							{if condition="$type==1"}
							<span>{if condition="$agreement['status']==0"}审核中{else/}已通过{/if}</span>
							{else/}
							{if condition="$agreement['status']==0"}<a class="pass" href="javascript:pass_agreement({$agreement.id});">通过</a>{else/}已通过{/if}
							{/if}

						</div>
					</div>
				</div>
				{/volist}

			</div>
		</div>
	</div>
	
</body>
<script>
	function pass_agreement(id) {
	    url="{:url('User/passAgreement')}";
        mui.confirm('您确认要通过对方的请求？', '提示', ['取消','确认'], function(e) {
            if (e.index == 1) {
                $.post(url,{id:id},function(data){
                    var data=JSON.parse(data);
                    if(data.status==0)
                    {
						mui.alert(data.info,"提示",function(){
						    location.reload();
						})
                    }else{
                        mui.toast(data.info);
					}
                })
            } else {

            }
        })

    }
</script>
</html>